{  Statement: http://acmp.ru/?main=task&id_task=98
   Verdict: Accepted
}
uses
    SysUtils, Math;

var
    i, n, h, t : longint;
    x, y : int64;
    a : array[0..10010] of longint;
    cur : boolean;
    
begin
    reset(input,'input.txt');
    rewrite(output,'output.txt');
    read(n);
    for i := 1 to n do
        read(a[i]);
    h := 1;
    t := n;
    x := 0;
    y := 0;
    cur := true;
    while t >= h do begin
        if a[h] >= a[t] then begin
            if cur then inc(x, a[h]) else inc(y, a[h]);
            inc(h);
        end else begin
            if cur then inc(x, a[t]) else inc(y, a[t]);
            dec(t);
        end;
        cur := not cur;
    end; 
    write(x, ':', y);
end.
